// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   Frame.java

package com.tool.tcp;

import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;

public class Frame {

	private static final long serialVersionUID = 0x1e69be2e1f00d756L;
	private Image image;
	private int pos;
	private int refPixelX;
	private int refPixelY;

	public Frame(int pos)
	{
		this.pos = pos;
	}

	public Frame(BufferedImage image, int centerX, int centerY)
	{
		this.image = image;
		refPixelX = centerX;
		refPixelY = centerY;
	}

	public Frame(Image image, int centerX, int centerY)
	{
		this.image = image;
		refPixelX = centerX;
		refPixelY = centerY;
	}

	public Image getImage()
	{
		return image;
	}

	public void dispose()
	{
		image = null;
	}

	protected void doDraw(Graphics2D g2, int x, int y, int width, int height)
	{
		int x1 = x - refPixelX;
		int y1 = y - refPixelY;
		g2.drawImage(image, x1, y1, x1 + width, y1 + height, 0, 0, width, height, null);
	}

	public int getRefPixelX()
	{
		return refPixelX;
	}

	public void setRefPixelX(int centerX)
	{
		refPixelX = centerX;
	}

	public int getRefPixelY()
	{
		return refPixelY;
	}

	public void setRefPixelY(int centerY)
	{
		refPixelY = centerY;
	}

	public void setImage(BufferedImage image)
	{
		pos = 0;
		this.image = image;
	}

	public void setImage(Image image, int x, int y)
	{
		pos = 1;
		refPixelX = x;
		refPixelY = y;
		this.image = image;
	}

	public boolean contains(int x, int y)
	{
		return false;
	}

	public int getWidth()
	{
		return image.getWidth(null);
	}

	public int getHeight()
	{
		return image.getHeight(null);
	}

	public int getPos()
	{
		return pos;
	}

	public void setPos(int pos)
	{
		this.pos = pos;
	}
}
